#!/usr/bin/env bash

node ./support/app &
pid=$!

bench() {
  ab -n 5000 -c 50 -k -q http://127.0.0.1:8000$1 | grep "Requests per" | cut -d ' ' -f 7 | xargs echo "$2:"
}

sleep .5
bench / "Hello World"
bench /json "JSON"
bench /middleware "Middleware"

kill -9 $pid